package cn.com.oidreams.aliyun.robot.entity;

import cn.com.oidreams.aliyun.robot.enums.DingTalkEnum;
import cn.com.oidreams.common.annotations.Required;
import lombok.Data;

import java.util.List;

/***
 ** @category 文本消息
 ** @author qing.yunhui
 ** @email: qingyh@glodon.com
 ** @createTime: 2021-11-24 14:29
 **/
@Data
public class TextMsgRequest extends BaseRequest {

    @Required(errorMsg = "text不能为空",remark="text",classParse = true)
    private Text text;
    private At at;
    @Data
    public static class At{
        /**
         * <p>是否@所有人</p>
         * */
        private boolean isAtAll;
        /**
         * <p>注意:在content里添加@人的手机号，且只有在群内的成员才可被@，非群内成员手机号会被脱敏。</p>
         * */
        private List<String> atMobiles;
        /**
         * <p>被@人的用户userid。注意:在content里添加@人的userid。</p>
         * */
        private List<String> atUserIds;
    }
    @Data
    public static class Text {
        @Required(errorMsg = "消息内容不能为空",remark="消息内容",classParse = false)
        private String content;
        public Text(String content) { this.content = content; }
    }
    public TextMsgRequest(){super();}
    public TextMsgRequest(Text text, At at,String secret) {
        super.setMsgtype(DingTalkEnum.MSG_TYPE.TEXT.getCode());
        this.text = text;
        this.at = at;
        super.setTimestamp(System.currentTimeMillis());
        super.setSecret(secret);
    }
    public TextMsgRequest(Text text,String secret){ this(text,null,secret); }

}
